package Interview;

import java.util.Scanner;

/**
 * Created by Administrator on 2017/4/1.
 */
public class _qunawang_20170401Test3 {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
//        int count = 1;
        while (input.hasNext()) {
            String str = input.nextLine();
            long output = 0;
            if (str == "") {
                System.out.println(0 + "");
            }
            long count = 1;
            for (int i = str.length() - 1; i >= 0; i--) {
                output += (str.charAt(i) - 'a') * count;
                count *= 26;
            }
            System.out.println(output + "");
//            count = 0;
        }
    }
}
